<!DOCTYPE html>
<html>
 <head>
    	<meta charset="utf-8">
        <!-- <script src="assets/js/angular.js"></script> -->
        <base href="${request.scheme}://${request.serverName}:${request.serverPort}${request.contextPath}/" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-3.3.5/css/bootstrap.css">
		<link rel="stylesheet" type="text/css" href="assets/css/index.css">
		<link rel="stylesheet" type="text/css" href="assets/icon/iconfont.css">
		<!-- 自定义滚动条所需要引用的样式 -->
		<link rel="stylesheet" type="text/css" href="assets/plugins/malihu-custom-scrollbar-plugin-3.1.3/jquery.mCustomScrollbar.min.css">
		
		<!-- <link rel="stylesheet" href="assets/plugins/zTree_v3/css/demo.css" type="text/css"> -->
		<link rel="stylesheet" href="assets/plugins/zTree_v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
		<!-- bootstap开关按钮 -->
		<link rel="stylesheet" href="assets/plugins/bootstrap-switch-master/dist/css/bootstrap3/bootstrap-switch.min.css" type="text/css">
		<link rel="stylesheet" href="assets/plugins/laydate-v1.1/laydate/need/laydate.css" type="text/css">
		<link rel="stylesheet" href="assets/plugins/laydate-v1.1/laydate/skins/yalan/laydate.css" type="text/css">
		<link rel="stylesheet" href="assets/plugins/umeditor-v1.2.2/themes/default/css/umeditor.css" type="text/css" >
		<link href="assets/htwj/logo.ico" rel="shortcut icon">
    </head>
  <style>
.error{
	padding-top:8px;
	color:red;
}
</style>  
    
<body>
<nav class="navbar navbar-default">
  <div class="container-fluid" >
    <div class="navbar-header">
      <a class="navbar-brand" href="#">
        <img alt="首页" src="...">
      </a>
    </div>
  </div>
</nav>

	<div class="main-content">
		<div class="main-content-inner">
			<div class="page-content">
			<!-- <div style="height: 200px"></div> -->
			
				<div class="row">
					<div class="col-xs-2"></div>
					<div class="col-xs-8">
					<div class="panel panel-primary">
			<div class="panel-heading">
			 <h3 class="panel-title">修改密码</h3>
			</div>
			<div class="panel-body">
						<form action="" class="form-horizontal" id="updatePass" method="post">
						
							<div class="form-group">
								<label  class="col-sm-2 control-label">旧密码</label>
								<div class="col-sm-10">
									<input type="password" name="oldPass" class="form-control"
										placeholder="请输入旧密码" required>
								</div>
							</div>
							<div class="form-group">
								<label  class="col-sm-2 control-label">新密码</label>
								<div class="col-sm-10">
									<input type="password" name="pass" id="pass" class="form-control "
										placeholder="请输入新密码" required>
								</div>
							</div>
							<div class="form-group">
								<label  class="col-sm-2 control-label">确认密码</label>
								<div class="col-sm-10">
									<input type="password" name="rePass" class="form-control"
										placeholder="请确认新密码" required="required">
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-offset-2 col-sm-10">
									<input id="update" type="submit" class="btn btn-default" value="修改密码">
								</div>
							</div>
						</form> 

					</div>
					<div class="panel-footer">
				<span style="color: rgb(0,153,255);" class="glyphicon glyphicon-info-sign"></span>&nbsp;定期更换密码可以让你的账号更加安全。<br>
				&nbsp;&nbsp;&nbsp;&nbsp;建议密码采用字母和数字混合，并不短于6位。
					</div>
					</div>
					</div>
					<div class="col-xs-2"></div>
					
				</div>
				</div>
				</div>
			</div>
</body>
<script type="text/javascript" src="assets/js/jquery1_12.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-validation-1.14.0/dist/localization/messages_zh.js"></script>
<script type="text/javascript" src="assets/plugins/layer-v2.4/layer/layer.js"></script>
<script type="text/javascript">
$.validator.setDefaults({
    	 rules:{
	 		pass: {
		        required: true,
		        minlength:6,
		        maxlength:18,
		      },
		      rePass: {
		        required: true,
		        minlength:6,
		        maxlength:18,
		        equalTo: "#pass",
		      }
	 	},
	 	messages: {
	 		pass: {
	 	       	required: "请输入新密码",
	 	       	minlength: "密码长度不能小于 6 个字母",
	 	       	maxlength: "密码长度不能大于 18个字母",
	 	     },
	 	    rePass: {
		        required: "请输入确认密码",
		        minlength: "密码长度不能小于 6 个字母",
		        maxlength: "密码长度不能大于 18个字母", 
		        equalTo: "两次密码输入不一致",
		      } 
	 	}, 
	 	submitHandler: function() {
    	$.post("user/updatePass",$("#updatePass").serialize(), function(data) {
    		if (data.code==0) {
    			layer.msg("密码修改成功！");
    			setTimeout(function(){
    				window.location.href = "${request.contextPath}/index";
    			}, 1000)
    		}else{
    			layer.alert(data.content);
    		} 
    	});
    }
});
$("#updatePass").validate();
</script>
</html>